package cn.array;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/3/5 14:15
 */
public class Main {
    public static void main(String[] args) {
        // 创建数组对象：
        DyArrayList<Integer> dyArrayList = new DyArrayList<>();
        dyArrayList.add(0);
        dyArrayList.add(1);
        dyArrayList.add(2);
        dyArrayList.add(3);
        dyArrayList.add(4);
        dyArrayList.add(5);
        dyArrayList.add(6);
        dyArrayList.add(7);
        dyArrayList.add(8);
        //dyArrayList.remove(7);
        dyArrayList.add(7,99);
        System.out.println(dyArrayList);
        System.out.println("返回元素的索引位置："+dyArrayList.indexOf(99));
        System.out.println("返回数组的容量："+dyArrayList.size());
        System.out.println("是否包含某个元素："+dyArrayList.contains(99));
        System.out.println("获取索引处的值："+dyArrayList.get(7));
        System.out.println("判断数组是否为空："+dyArrayList.isEmpty());
        System.out.println("移除数组索引处的值："+dyArrayList.remove(8));
        System.out.println(dyArrayList);

        System.out.println("设置数组索引处的值："+dyArrayList.set(8,88888));
        System.out.println(dyArrayList);

        dyArrayList.clear();
        System.out.println("清空数组后："+dyArrayList);

        //Asserts.test(dyArrayList.get(2)==21);

        //DyArrayList<Person> dyArrayList1 = new DyArrayList<>();
        //
        //dyArrayList1.add(new Person(1,"tom1"));
        //dyArrayList1.add(new Person(2,"tom2"));
        //dyArrayList1.add(new Person(3,"tom3"));
        ////dyArrayList1.add(new Person(4,"tom4"));
        ////dyArrayList1.add(new Person(5,"tom5"));
        ////dyArrayList1.add(new Person(6,"tom6"));
        //
        //System.out.println(dyArrayList1);
        // 源码
        List<Integer> list = new ArrayList<>();
        // 提醒JVM进行垃圾回收
        System.gc();
    }
}
